<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<%@ page import="org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter" %>
<%@ page import="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter" %>
<%@ page import="org.springframework.security.web.WebAttributes" %>

<%@page import="org.springframework.security.authentication.BadCredentialsException"%><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>至好软件－客户关系管理系统登录</title>
<%@ include file="/common/meta.jsp" %>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	overflow:hidden;
}
.error{
font-size:11pt;
color:white;
line-height:25px;
z-index:5;
width:400px;
height:500px;
text-align:center;
position:absolute;
top:20%;
left:40%;
}
.STYLE3 {font-size: 12px; color: #adc9d9; }
-->
</style>

</head>
<body>
<form id="loginForm" name="loginForm" action="${ctx}/j_spring_security_check" method="post" style="margin:0">
<%
BadCredentialsException e = (BadCredentialsException)session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);

%>
                    <%
	if (e!= null) {
		//e.printStackTrace();
		String msg = e.getMessage();
		if(msg.contains("Bad credentials")){
			msg = "密码错误！";
		}
%> 
<div class="error"> <%=msg %></div> 
<%
	}
%>
<table width="100%"  height="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td bgcolor="#1075b1">&nbsp;</td>
  </tr>
  <tr>
    <td height="608" background="${ctx}/images/login_03.gif"><table width="847" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="318" background="${ctx}/images/login_04.gif">&nbsp;</td>
      </tr>
      <tr>
        <td height="84"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="381" height="84" background="${ctx}/images/login_06.gif">&nbsp;</td>
            <td width="162" valign="middle" background="${ctx}/images/login_07.gif">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="44" height="24" valign="bottom"><div align="right"><span class="STYLE3">用户名</span></div></td>
                <td width="10" valign="bottom">&nbsp;</td>
                <td height="24" colspan="2" valign="bottom">
                  <div align="left">
                    <input type="text" value="admin" id='j_username' name='j_username' class="validate[required]" style="width:100px; height:17px; background-color:#87adbf; border:solid 1px #153966; font-size:12px; color:#283439; " />
                  	<s:if test="not empty param.error">
						value='<%=session.getAttribute(UsernamePasswordAuthenticationFilter.SPRING_SECURITY_LAST_USERNAME_KEY)%>'</s:if> 
                  </div></td>
              </tr>
              <tr>
                <td height="24" valign="bottom"><div align="right"><span class="STYLE3">密　码</span></div></td>
                <td width="10" valign="bottom">&nbsp;</td>
                <td height="24" colspan="2" valign="bottom"><input value="111111" type='password' id='j_password' name='j_password' class="validate[required]" style="width:100px; height:17px; background-color:#87adbf; border:solid 1px #153966; font-size:12px; color:#283439; "></td>
              </tr>
              <tr>
                <td height="24" valign="bottom"><div align="right"><span class="STYLE3">验证码</span></div></td>
                <td width="10" valign="bottom">&nbsp;</td>
                <td width="52" height="24" valign="bottom"><input type="text" name="checkcode" id="checkcode" value="2561" style="width:50px; height:17px; background-color:#87adbf; border:solid 1px #153966; font-size:12px; color:#283439; "></td>
                <td width="62" valign="bottom"><div align="left"><img src="${ctx}/images/yzm.gif" width="38" height="15"></div></td>
              </tr>
              <tr></tr>
            </table></td>
            <td width="26"><img src="${ctx}/images/login_08.gif" width="26" height="84"></td>
            <td width="67" background="${ctx}/images/login_09.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="25"><div align="center"><input type="image" src="${ctx}/images/dl.gif" width="57" height="20"></div></td>
              </tr>
              <tr>
                <td height="25"><div align="center"><img src="${ctx}/images/cz.gif" width="57" height="20" onclick="loginForm.reset();"></div></td>
              </tr>
            </table></td>
            <td width="211" background="${ctx}/images/login_10.gif">&nbsp;</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td height="206" background="${ctx}/images/login_11.gif">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td bgcolor="#152753">&nbsp;</td>
  </tr>
</table>
</form>
</body>
</html>
